import requests
import json
import datetime

lock_data = {
	"showId": 12591900,
	"priceList": [{
		"num": 1,
		"priceId": "",
		"saleclassId": None,
		"ticketTotalCount": 1,
		"isCombine": False
	}],
	"productSourceEnum": "DM",
	"productId": 7492700,
	"salesType": None
}
proxies = {"http": None, "https": None}
mainheader = {
    "Host": "gateway-medusa.polyt.cn",
    "Connection": "keep-alive",
    "City-Code": "110100",
    "Theater": "40",
    "Flagship-Store": "false",
    "Authorization": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJJWUdkUzR3Z3p3K0NoYkQrcE5FK2J5Mnk4MjhLdzMxQXlIbE5EWWJUYmhaK05OREtZVDI0RWJpRURlajdEV1k9IiwiaXNzIjoicGxhdF93ZWNoYXRfbWluaWFwcCIsImV4cCI6NDg4NDA2NTAxMywiaWF0IjoxNzMwNDY1MDEzfQ.ovY9iQNZoS4i4NqpyGvDGk9tGHASSJ0LXC4fxGwXmcE",
    "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36 MicroMessenger/7.0.20.1781(0x6700143B) NetType/WIFI MiniProgramEnv/Windows WindowsWechat/WMPF WindowsWechat(0x63090c11)XWEB/11275",
    "Content-Type": "application/json",
    "Location": ",",
    "xweb_xhr": "1",
    "Channel": "plat_wechat_miniapp",
    "Accept": "*/*",
    "Sec-Fetch-Site": "cross-site",
    "Sec-Fetch-Mode": "cors",
    "Sec-Fetch-Dest": "empty",
    "Referer": "https://servicewechat.com/wx536632e7856b12bb/57/page-frame.html",
    "Accept-Encoding": "gzip, deflate, br",
    "Accept-Language": "zh-CN,zh;q=0.9"
}
while datetime.datetime.now() < datetime.datetime(2024, 11, 2, 17, 59, 59, 700):
    pass


priceflag = False
for i in range(2):
    url = "https://gateway-medusa.polyt.cn/good/shows/7492700"
    res = requests.get(url, headers=mainheader, proxies=proxies)
    ticketPriceList = res.json().get("data").get("showInfoDetailList")[1].get("ticketPriceList")
    if len(ticketPriceList) != 0:
        priceflag = True
        lock_data["priceList"][0]["priceId"] = ticketPriceList[0].get("priceId")


if priceflag:
    pass

